﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.kbwsoft.esiframe.usermanage.*"%>
<%@ page import="com.kbwsoft.esiframe.core.util.*"%>
<%@ page import="sun.jdbc.rowset.*"%>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/" + "mobileweb";
  String ipPath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();
  String userid = request.getParameter("userid");
  String duserid = request.getParameter("duserid");
  String username = "";
  String type = request.getParameter("type");
  DBTransUtil transUtil = new DBTransUtil();
  //System.out.println("select * from v_ctcord where ostatus <> '08' and puserid = '" + userid + "' order by otime desc ");
  CachedRowSet crs1 = null;
  CachedRowSet crs2 = null;
  CachedRowSet crs3 = null;
  if(type.equals("d1")&&!duserid.equals("")){//医生查看患者订单列表
    crs2 = transUtil.getResultBySelect("select * from v_ctcord where ostatus in ('06','07') and puserid = '" + userid + "' and duserid='"+duserid+"' order by otime  ");
  }else{//患者自己查看
    Userxx user = (Userxx)session.getAttribute(GlobalNames.LOGIN_USER);
    if( user == null || user.getUserid().equals("") ){
      out.println("<script language=JavaScript>");
	  out.println("alert('登录超时');");
      out.println("location = 'index.jsp';");
      out.println("</script>");
    }else{
	  userid = user.getUserid();
	  username = user.getUsername();
    }
	System.out.println("select * from v_ctcord where ostatus <> '08' and puserid = '" + userid + "' order by otime desc ");
	crs1 = transUtil.getResultBySelect("select * from v_ctcord where ostatus <> '08' and puserid = '" + userid + "' order by otime desc ");
    crs2 = transUtil.getResultBySelect("select * from v_ctcord where ostatus in ('06','07') and puserid = '" + userid + "' order by otime ");
  }
  crs3 = transUtil.getResultBySelect("select * from v_ctcord where ostatus in ('06','07') and puserid = '" + userid + "' order by otime  ");

%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>垂直检测医疗服务平台 | 信锐利鸿</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="format-detection" content="telephone=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
	<script type="text/javascript" src="<%=basePath%>/assets/js/jquery.min.js"></script>

    <script type="text/javascript" src="../js/jquery.easyui-1.2.4.js"></script>
<!--<![endif]-->
<script type="text/javascript" src="<%=basePath%>/assets/js/amazeui.min.js"></script>
<script type="text/javascript" src="../js/mask.js"></script>
    <link rel="alternate icon" type="image/png" href="<%=basePath%>/assets/i/favicon.png">
    <link rel="stylesheet" href="<%=basePath%>/assets/css/amazeui.min.css"/>
	<script src="../js/highcharts.js"></script>
<script src="../js/exporting.js"></script>
    <style>
        .get {
            background: #1E5B94;
            color: #fff;
            text-align: center;
            padding: 100px 0;
        }

        .get-title {
            font-size: 200%;
            border: 2px solid #fff;
            padding: 20px;
            display: inline-block;
        }

        .get-btn {
            background: #fff;
        }

        .detail {
            background: #fff;
        }

        .detail-h2 {
            text-align: center;
            font-size: 150%;
            margin: 40px 0;
        }

        .detail-h3 {
            color: #1f8dd6;
        }

        .detail-p {
            color: #7f8c8d;
        }

        .detail-mb {
            margin-bottom: 30px;
        }

        .hope {
            background: #0bb59b;
            padding: 50px 0;
        }

        .hope-img {
            text-align: center;
        }

        .hope-hr {
            border-color: #149C88;
        }

        .hope-title {
            font-size: 140%;
        }

        .about {
            background: #fff;
            padding: 40px 0;
            color: #7f8c8d;
        }

        .about-color {
            color: #34495e;
        }

        .about-title {
            font-size: 180%;
            padding: 30px 0 50px 0;
            text-align: center;
        }

        .footer p {
            color: #7f8c8d;
            margin: 0;
            padding: 15px 0;
            text-align: center;
            background: #2d3e50;
        }
    </style>
</head>

<body>
<header class="am-topbar am-topbar-fixed-top">
    <div class="am-container">
        <h1 class="am-topbar-brand">
            <a href="#">垂直检测医疗服务平台</a>
        </h1>
        <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-secondary am-show-sm-only"
                data-am-collapse="{target: '#collapse-head'}"><span class="am-sr-only">导航切换</span> <span
                class="am-icon-bars"></span></button>
        <div class="am-collapse am-topbar-collapse" id="collapse-head">
            <ul class="am-nav am-nav-pills am-topbar-nav">
                <li><a href="<%=basePath%>/index.jsp">首页</a></li>
                <li><a href="<%=basePath%>/center.jsp">检测中心</a></li>
                <li class="am-dropdown" data-am-dropdown>
                    <a class="am-dropdown-toggle" data-am-dropdown-toggle href="javascript:;">
                        其他 <span class="am-icon-caret-down"></span>
                    </a>
                    <ul class="am-dropdown-content">
                        <li class="am-dropdown-header">标题</li>
                        <li><a href="<%=basePath%>/aboutus.jsp">公司简介</a></li>
                        <li><a href="<%=basePath%>/list.jsp">最新动态</a></li>
                        <li><a href="<%=basePath%>/list.jsp">科普知识</a></li>
                        <li><a href="<%=basePath%>/contactus.jsp">联系我们</a></li>
                        <li><a href="<%=basePath%>/qa.jsp">常见问题</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</header>


<!-- 表单开始 -->

<%if(type.equals("p1")){%>
<script src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>
<script src="http://cdn.hcharts.cn/highcharts/modules/exporting.js"></script>
<div class="detail">
<div class="am-container">
<ul class="am-list am-list-static am-list-striped">
  <% if(crs2.next()){%>
    <li><i class="am-icon-user am-icon-fw"></i>尊敬的<%=username%>，您好。</li>
  <%}%>
  <% if(crs1.size() <= 0) {%>
    <li>没有订单</li>
  <% }else{ while(crs1.next()){ %>
    <!--患者-订单列表-->
	<li>
	  订单编号：<%=Tools.nvl(crs1.getString("ocode"))%><br />
	  检测项目：<%=Tools.nvl(crs1.getString("otypename"))%><br />
	  接诊医生：<%=Tools.nvl(crs1.getString("dusername"))%><br />
	  检查时间：<%=Tools.nvl(crs1.getString("otimemc"))%><br />
	  订单状态：<%=Tools.nvl(crs1.getString("ostatusname"))%><br />
	  <%if(Tools.nvl(crs1.getString("ostatus")).equals("06")){
          if(Tools.nvl(crs1.getString("jctype")).equals("ctc检测")){
            String pages = transUtil.getColumnValue("select f_get_ctcord_pages('"+Tools.nvl(crs1.getString("oid"))+"')");
              if(pages.equals("1")){
      %>
        <a href="<%=ipPath%>/ctc/print_jasper.jsp?report=report&p_oid=<%=Tools.nvl(crs1.getString("oid"))%>" style="color:#0000FF" target="_blank">查看报告</a>
      <%}else if(pages.equals("2")){%>
        <a href="<%=ipPath%>/ctc/print_jasper2.jsp?p_oid=<%=Tools.nvl(crs1.getString("oid"))%>" style="color:#0000FF" target="_blank">查看报告</a>
      <%}else if(pages.equals("3")||pages.equals("4")){%>
        <a href="<%=ipPath%>/ctc/print_jasper3.jsp?p_oid=<%=Tools.nvl(crs1.getString("oid"))%>" style="color:#0000FF" target="_blank">查看报告</a>
      <%      }
	        }else{%>
        <a href="<%=ipPath%>/ctc/order/order_report_view.jsp?oid=<%=Tools.nvl(crs1.getString("oid"))%>" style="color:#0000FF" target="_blank">查看报告</a>
	  <%    }
	      }
      %>
	</li>
  <%}}%>
</ul>
</div>
</div>
<%}%>


<%if(type.equals("d1")){%>
<div class="detail">
<div class="am-container">
<ul class="am-list am-list-static am-list-striped">
  <% if(crs2.next()){%>
    <li><i class="am-icon-user am-icon-fw"></i>患者：<%=Tools.nvl(crs2.getString("pusername"))%></li>
  <%}%>
  <% crs2.beforeFirst(); if(crs2.size() <= 0) {%>
    <li>没有订单</li>
  <% }else{ while(crs2.next()){ %>
    <!--患者-订单列表-->
	<li>
	  订单编号：<%=Tools.nvl(crs2.getString("ocode"))%><br />
	  报告时间：<%=Tools.nvl(crs2.getString("stimemc"))%><br />
	  CTC数值：<%=Tools.nvl(crs2.getString("testvalue"))%>个/7.5ml<br />
	</li>
  <%}}%>
</ul>
</div>
<div id="container" class="am-container" style="height:250px;"></div>
</div>
<%}%>

  <footer data-am-widget="footer" class="am-footer am-footer-default" data-am-footer="{  }">
    <div class="am-footer-miscs ">
        <p>ADD:天津市东丽区华明高新区低碳产业基地B4-210室 </p>
        <p>CopyRight©2015 <a href="<%=basePath%>/aboutus.html" target="_blank">垂直检测医疗服务平台</a> All Rights Reserved.</p>
        <p>津ICP备15008369号-1</p>
    </div>
  </footer>
</body>

<script language="javascript">

$(function () {
    $('#container').highcharts({
	      chart: {
            type: 'spline'
        },
        title: {
            text: '患者CTC数值变化曲线',
            x: -20 //center
        },
        subtitle: {
            text: '',
            x: -20
        },
        xAxis: {
            categories: [
			  <%
			  int k = 0;
       while(crs3.next()){
	   k++;
	   if(k>1){
  %>
  ,
  <%}%>
  '第<%=k%>次'

  <%}%>
			]
        },
        yAxis: {
            title: {
                text: 'CTC(个/7.5ml)'
            },
            plotLines: [{
                value: 0,
                width: 1,
                color: '#808080'
            }]
        },
        tooltip: {
            valueSuffix: '个/7.5ml'
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'middle',
            borderWidth: 0
        },
        series: [{
            name: 'CTC值',
            data: [
			  <% crs3.beforeFirst();
			  int l = 0;
       while(crs3.next()){
	   l++;
	   if(l>1){
  %>
  ,
  <%}%>
  <%=Tools.nvl(crs3.getString("testvalue"))%>

  <%}%>


			]
        }]
    });
});
</script>
